﻿<%@ Page Title="List Page" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="BeachesList.aspx.vb" Inherits="BeachesInGreeceComplete.BeachesList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </ajaxToolkit:ToolkitScriptManager>
    <div class="aside2">
        <br />
        <h3>
            Search</h3>
        <br />
        <br />
        <asp:TextBox ID="tb_search" runat="server" />
        <br />
        <table>
            <tr>
                <td>
                    <asp:Button ID="btn_findByName" runat="server" Text="By Name" CssClass="m-btn blue" />
                </td>
                <td>
                    <asp:Button ID="btn_findByRegion" runat="server" Text="By Region" CssClass="m-btn blue" />
                </td>
            </tr>
        </table>
        <br />
        <h3>
            Tag Cloud</h3>
        <div class="CloudBox">
            <br />
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT BeachTagJunction.Tag_FK, Count(BeachTagJunction.Tag_FK) AS TotalTags, Tags.Tag
                            FROM Tags INNER JOIN BeachTagJunction ON Tags.ID = BeachTagJunction.Tag_FK
                            GROUP BY BeachTagJunction.Tag_FK, Tags.Tag"></asp:SqlDataSource>
            <asp:Literal ID="CloudTags" runat="server"></asp:Literal>
        </div>
        <br />
        <br />
        <div>
            <h3>
                Sort</h3>
            <br />
            <table>
                <tr>
                    <td>
                        <asp:LinkButton ID="lb_Likes" runat="server">By Likes</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="lb_Rating" runat="server">By Rating</asp:LinkButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:LinkButton ID="lb_Views" runat="server">By Views</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="lb_Comments" runat="server">By Comments</asp:LinkButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:LinkButton ID="lb_Flag" runat="server">By Blue Flag</asp:LinkButton>
                    </td>
                </tr>
            </table>
            <br />
            <br />
        </div>
    </div>
    <h2 id="myHeading" runat="server">
    </h2>
    <asp:Button ID="btn_AddBeach" runat="server" Text="Add Beach" CssClass="m-btn purple"
        PostBackUrl="~/AddBeach.aspx" />
    <div class="mainDiv2">
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource2">
            <ItemTemplate>
                <li class="hoverClass">
                    <asp:Label ID="lbl_Name" CssClass="BeachNameLabel" runat="server" Text='<%# Eval("BeachName") %>' />
                    <br />
                    <asp:Label ID="lbl_Region" CssClass="RegionLabel" runat="server" Text='<%# Eval("Region") %>' />
                    <br />
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "BeachDetails.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="100" height="100" style="border-style: solid; border-width: medium" />
                    </asp:HyperLink>
                    <br />
                    <asp:Label ID="lbl_Time" runat="server" Text='<%# CalculateTime.calculateTimeNoHours(Eval("DateAdded")) %>'
                        ForeColor="#009999" />
                    •
                    <asp:Label ID="Label1" runat="server" Text='<%# getViews(Eval("ID")) %>' CssClass="myButton" />
                    <br />
                    By •
                    <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("Tourist")%>' NavigateUrl='<%# Eval("Tourist", "Profile.aspx?Tourist={0}") %>'
                        ForeColor="Red" Font-Bold="True" CssClass="red" Font-Size="Smaller">
                        <asp:Label ID="TouristLabel" CssClass="BeachNameLabel" runat="server" Text='<%# Eval("Tourist") %>' />
                    </asp:HyperLink><br />
                </li>
            </ItemTemplate>
            <LayoutTemplate>
                <ul class="ItemContainer">
                    <li runat="server" id="itemPlaceholder" />
                </ul>
            </LayoutTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
            ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [Beaches] ORDER BY DateAdded DESC">
        </asp:SqlDataSource>
        <br />
        <div class="nextLine">
            <asp:DataPager ID="DataPagerBeaches" runat="server" PagedControlID="ListView1" PageSize="12">
                <Fields>
                    <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                    <asp:NumericPagerField ButtonType="Link" />
                    <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                </Fields>
            </asp:DataPager>
        </div>
        <br />
    </div>
    <br />
</asp:Content>
